package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.SupervisionBasicDao;
import com.chinasi.model.SupervisionBasic;
import com.chinasi.service.SupervisionBasicService;

@Service
public class SupervisionBasicServiceImpl implements SupervisionBasicService {

	/**
	 * SupervisionBasicDAO
	 */
	@Autowired
	private SupervisionBasicDao SupervisionBasicDao;

	@Override
	public Pager findPageCondition(SupervisionBasic searchBean,
			int currentPage) {
		Pager pager = new Pager(SupervisionBasicDao.getTotalCount(searchBean),currentPage);
		pager.setData(SupervisionBasicDao.findByCondition(searchBean, pager.getStartRow(), pager.getPageSize()));
		return pager;
	}

	@Override
	public SupervisionBasic findById(String id) {
		return SupervisionBasicDao.findByPK(id, SupervisionBasic.class);
	}
	
	@Override
	public int findTotalCount(){
		return SupervisionBasicDao.getTotalCount(new SupervisionBasic());
	}
	
}
